package com.hs.sfzy.mapper;

import com.hs.sfzy.entity.CourseCollect;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
@Mapper
public interface CourseCollectMapper {

    int insert(CourseCollect courseCollect);
    int exists(@Param("userId") int userId, @Param("courseId") int courseId);
    int updatePayStatus(@Param("userId") int userId, @Param("courseId") int courseId, @Param("isok") int isok);
    List<CourseCollect> selectWithRelations(@Param("userId") int userId, @Param("payStatus") int payStatus);
    int delete(@Param("userId") Integer userId, @Param("courseId") Integer courseId);
    //根据用户id级联查询课程
    List<CourseCollect> getCourseCollectByUserId(Integer userId);

    //添加课程收藏
    Integer addCourseCollect(CourseCollect courseCollect);

    // 把uid和cid增加到收藏表中
    Integer addCourseCollectByUidAndCid(@Param("userId") Integer userId, @Param("courseId") Integer courseId);

    // 检查课程是否被收藏
    CourseCollect checkIsCollected(@Param("userId") Integer userId, @Param("courseId") Integer courseId);
}
